package com.bitmain.mmst.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.bitmain.mmst.core.struct.APIResult;
import com.bitmain.mmst.domain.Miner;
import com.bitmain.mmst.web.service.MacModelService;

/**
 *
 * @author Richard - rui.wu@bitmain.com
 * @since 2016年8月26日
 * 
*/

@Controller
@RequestMapping("miner")
public class MacModelController {

	@Autowired
	private MacModelService macModelService;
	
	@RequestMapping(value="macmodel", method=RequestMethod.GET)
	public ModelAndView macmodel(){
		ModelAndView mv = new ModelAndView("miner/macmodel");
		return mv;
	}
	
	@RequestMapping(value="macmodels", method=RequestMethod.POST)
	@ResponseBody
	public APIResult post(@RequestBody Miner miner){
		System.out.println("---------进入到了macmodels的controller");
		APIResult result = new APIResult();
		if(miner==null){
			result.setSuccess(false);
			return result;
		}
		int rs = 1;
		//int rs = macModelService.add(miner);
		if(rs==0){
			result.setSuccess(false);
		}else if(rs==1){
			result.setSuccess(true);
		}else{
			result.setSuccess(false);
		}
		return result;
	}
}

